//
//  ZxFmLiveViewModel.m
//  XiMaFM
//
//  Created by fanzhuxian on 2017/9/4.
//  Copyright © 2017年 hcios. All rights reserved.
//

#import "ZxFmLiveViewModel.h"

#import "ZxFmLiveModel.h"
#import "ZxHomePageNetManager.h"

@implementation ZxFmLiveViewModel

- (void)getDataCompletionHandle:(void (^)(NSError *))completed {

    self.dataTask = [ZxHomePageNetManager getLiveCompletionHandle:^(ZxFmLiveModel* responseObject, NSError *error) {
        
        self.model = responseObject;
        self.livesContentsArr = responseObject.data.lives;
        self.section = _livesContentsArr.count;
        
        completed(error);
    }];
}

#pragma mark  section是组数, index是按钮下标( 或者行标号)
// 图
// 热门推荐 列表(外层需要HotR_List_List* 读取数组中的对象)
- (NSURL *)coverURLForSection:(NSInteger)section index:(NSInteger)index {
    NSString *path = nil;
    path =  self.model.data.lives[index].coverLarge;
    
    return [NSURL URLWithString:path];
}

// icon
- (NSURL *)avatarForSection:(NSInteger)section index:(NSInteger)index{
    NSString *path = nil;
    path =  self.model.data.lives[index].avatar;
    
    return [NSURL URLWithString:path];
}

// 主播
- (NSString *)nicknameForSection:(NSInteger)section index:(NSInteger)index{
    return self.model.data.lives[index].nickname;
    
}
// 标题
- (NSString *)nameForSection:(NSInteger)section index:(NSInteger)index{
    return self.model.data.lives[index].name;
}

// 评论人数
- (NSInteger)playCountForSection:(NSInteger)section index:(NSInteger)index{
    return self.model.data.lives[index].playCount;
    
}

//标签
- (NSString *)categoryNameForSection:(NSInteger)section index:(NSInteger)index{
    return self.model.data.lives[index].categoryName;
    
}

// 跳转键
- (NSInteger)albumIdForSection:(NSInteger)section index:(NSInteger)index{
    
    return self.model.data.lives[index].actualStartAt;
}


@end
